import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/special_list/work_history_entity.dart';

WorkHistoryEntity $WorkHistoryEntityFromJson(Map<String, dynamic> json) {
  final WorkHistoryEntity workHistoryEntity = WorkHistoryEntity();
  final int? ticketCount = jsonConvert.convert<int>(json['ticketCount']);
  if (ticketCount != null) {
    workHistoryEntity.ticketCount = ticketCount;
  }
  final String? ticketTypeId = jsonConvert.convert<String>(json['ticketTypeId']);
  if (ticketTypeId != null) {
    workHistoryEntity.ticketTypeId = ticketTypeId;
  }
  final String? ticketTypeName = jsonConvert.convert<String>(json['ticketTypeName']);
  if (ticketTypeName != null) {
    workHistoryEntity.ticketTypeName = ticketTypeName;
  }
  final String? workDate = jsonConvert.convert<String>(json['workDate']);
  if (workDate != null) {
    workHistoryEntity.workDate = workDate;
  }
  final double? value = jsonConvert.convert<double>(json['value']);
  if (value != null) {
    workHistoryEntity.value = value;
  }
  return workHistoryEntity;
}

Map<String, dynamic> $WorkHistoryEntityToJson(WorkHistoryEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['ticketCount'] = entity.ticketCount;
  data['ticketTypeId'] = entity.ticketTypeId;
  data['ticketTypeName'] = entity.ticketTypeName;
  data['workDate'] = entity.workDate;
  data['value'] = entity.value;
  return data;
}

extension WorkHistoryEntityExtension on WorkHistoryEntity {
  WorkHistoryEntity copyWith({
    int? ticketCount,
    String? ticketTypeId,
    String? ticketTypeName,
    String? workDate,
    double? value,
  }) {
    return WorkHistoryEntity()
      ..ticketCount = ticketCount ?? this.ticketCount
      ..ticketTypeId = ticketTypeId ?? this.ticketTypeId
      ..ticketTypeName = ticketTypeName ?? this.ticketTypeName
      ..workDate = workDate ?? this.workDate
      ..value = value ?? this.value;
  }
}
